package com.code.splider.controller;

import java.io.IOException;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.xml.sax.SAXException;

import com.code.splider.common.util.HttpClientUtils;
import com.code.splider.service.CornerService;
import com.meterware.httpunit.HttpUnitOptions;
import com.meterware.httpunit.WebConversation;

@Controller
@RequestMapping("corner")
public class CornerController {

	@Autowired
	private CornerService cornerService;

	@RequestMapping(value = "save")
	public String save() throws IOException, SAXException {
		System.out.println("向服务器发送数据，然后获取网页内容：");
		String html = HttpClientUtils.getHttpClient("http://live.dszuqiu.com/ajax/score/data?mt=0&nr=1&corner=1");
		if (null != html) {
			cornerService.saveCorner(html);
		}
		return "result";
	}

}
